package com.gf.controller.order;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gf.bean.Orderr;
import com.gf.service.impl.OrderrServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;


/*
 * 这是我的订单页面我下的订单里面处理那个撤销订单的servlet
 * */


@WebServlet(name = "DeleteOrderServlet",urlPatterns = "/deleteorder")
public class DeleteOrderServlet extends HttpServlet {
    static OrderrServiceImpl orderimpl = null;
    static {
        orderimpl=new OrderrServiceImpl();


    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        Orderr orderr = new Orderr();
        String order_id = request.getParameter("order_id");
        orderr.setOrder_id(order_id);
        orderimpl.deleteorderbyorderid(orderr);
        JSONObject backjson = new JSONObject();
        backjson.put("status", 200);
        backjson.put("data", "删除成功");

        out.println(JSON.toJSON(backjson));
        out.flush();
        out.close();
    }
}
